<html>
<head>
    <link rel="stylesheet" href="/pages/websocket/xterm.css"/>
    <script src="/pages/websocket/xterm.js"></script>
    <script src="/pages/websocket/addons/attach/attach.js"></script>
    <script src="/pages/websocket/addons/fit/fit.js"></script>
    <script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
    <script src="/pages/websocket/addons/fullscreen/fullscreen.js"></script>
</head>
<body>
<div id="terminal" style="height:100%;"></div>
<script type="text/javascript">
    var s = window.location.search.split("=")[1];
    console.log(s);
    var ip = returnCitySN["cip"];
    console.log(ip);
    var wsurl = 'ws://192.168.1.129:8080/webshell/'+s+"/"+ip;
    console.log(wsurl);
    Terminal.applyAddon(attach);  // Apply the `attach` addon
    Terminal.applyAddon(fit);
    Terminal.applyAddon(fullscreen);
    var term = new Terminal();
    term.open(document.getElementById('terminal'));
    term.fit();
    term.toggleFullScreen();  // Now the terminal should occupy the full viewport
    term.toggleFullScreen();  // Now the terminal should be back to normal

    var socket = new WebSocket(wsurl);
    term.attach(socket);  // Attach the above socket to `term`
</script>
</body>
</html>